﻿using System;
using System.Windows;
using System.Windows.Data;

namespace PhoneInfo
{
    public class FixEmptyUrl : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {  
            string url = (string)value;
            if (url==null||url.Length == 0)
            {
                //返回本地的Url;
                string localImage = "Icon/defaultIcon.png";
                return localImage;
            }
            return url.Trim();

        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}